package com.bolt.admin.module.sys.entity;

import com.bolt.support.spring.jpa.entity.BaseTreeAuditingEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

/**
 * 菜单对象
 * Created by Administrator on 2017/9/28.
 */

@Access(AccessType.FIELD)
@Entity
@Table(name = "SYS_MENU")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@DynamicInsert
@DynamicUpdate
@Data
@NoArgsConstructor
public class MenuEntity extends BaseTreeAuditingEntity<Long,MenuEntity> {



    public MenuEntity(Long id) {
        this.id = id;
    }

    @Id
    //@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "MENU_SEQ")
    //@SequenceGenerator(sequenceName = "menu_seq", allocationSize = 1, name = "MENU_SEQ")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "TITLE", nullable = false)
    @ApiModelProperty(value = "菜单标题")
    private String title;


    @Column(name = "URL")
    @ApiModelProperty(value = "路由地址")
    private String url;


    @Column(name = "icon")
    @ApiModelProperty(value = "菜单图标")
    private String icon;

    @Column(name = "name")
    @ApiModelProperty(value = "菜单组件名称")
    private String componentName;

    @ApiModelProperty(value = "组件路径")
    private String component;

    @ApiModelProperty(value = "外链菜单")
    private Boolean iFrame;

    @Column(columnDefinition = "bit(1) default 0")
    @ApiModelProperty(value = "缓存")
    private Boolean cache;

    @Column(columnDefinition = "bit(1) default 0")
    @ApiModelProperty(value = "是否隐藏")
    private Boolean hidden;

    @Column(columnDefinition = "bit(1) default 1")
    @ApiModelProperty(value = "是否可用")
    private Boolean enabled;

    @Column(name = "DESCRIPTION", length = 255)
    private String description;


}
